package com.example.b_308.software.view;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by B-308 on 2017/11/21.
 */
public abstract class BaseFragment extends Fragment {
    String title;
    View converView;

    public BaseFragment setTitle(String title) {
        this.title = title;
        return this;
    }

    public String getTitle() {
        return title;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        converView = setContentView(inflater);
        initData();
        initListener();
        return converView;
    }

    public abstract View setContentView(LayoutInflater inflater);

    public abstract void initData();

    public abstract void initView();

    public abstract void initListener();

    public <T extends View> T findViewById(int resoouce) {
        return (T) converView.findViewById(resoouce);
    }
}
